package com.jy.api.dao;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.jdbc.core.JdbcTemplate;

import java.util.List;
import java.util.Map;

/**
 * Created by lihu on 2018/1/22.
 */
public class MemberAccountDaoImpl {

    @Autowired
    JdbcTemplate jdbcTemplate;

    public List<Map<String, Object>> queryStoreInfo(String memberId, Pageable pageable) {
        String sql = "select store_id storeId,(amount+bonus) amount,points from member_account where member_id=? order by add_time desc limit ?,? ";
        return jdbcTemplate.queryForList(sql, memberId,
                pageable.getPageSize() * pageable.getPageNumber(), pageable.getPageSize());

    }
}
